package com.example.common.mapper;

import com.example.common.enetiy.AccessLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author qwer3
 * @version 1.0.0
 * @create 2025/11/9 19:15
 */
@Mapper
public interface AccessLogMapper {
    @Insert("""
INSERT INTO sys_login_log (user_id, timestamp, ip, country, browser, browser_version, operating_system,
                           device_type, device_category, network_type)
VALUES (#{userId}, #{timestamp}, #{ip}, #{country}, #{browser}, #{browserVersion},
        #{operatingSystem}, #{deviceType}, #{deviceCategory}, #{networkType});
""")
    void addLoginLog(AccessLog accessLog);

    @Select("""
select * from sys_login_log order by timestamp desc 
""")
    List<AccessLog> listAccessLog();
}
